﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>登录-水处理系统</title>
		<link href="css/login.css" rel="stylesheet" type="text/css" />
		<script src="js/jquery.js" type="text/javascript">
</script>
		<!--<script type="text/javascript" src="js/login.js">
</script>-->
		<script>
			
		function test(){
			var pwd=$("#pwd").val();
			var username=$("#username").val();
			if (username == "") {
				 $('#res').attr('innerHTML','<font color=red>请输入企业代码</font>');
				 $('#username').mousedown(function(){
                  $("font").hide();});
				return false;
			}else if(pwd==""){
				$('#res').attr('innerHTML','');
		   		$('#res1').attr('innerHTML','<font color=red>请输入密码</font>');
		   		 $('#pwd').mousedown(function(){
                    $("font").hide();});
		  		return false;
			}
			$.ajax({
				type:'POST',
		
				data:{
					pwd:pwd,
					username:username
				},
				dataType:'text',
				url: "loginCheck",
				success: function (result) {
					if(result==0){
						$('#res1').attr('innerHTML','');
						$('#res').attr('innerHTML','<font color=red size=4>您输入的企业代码或密码有错请重新输入</font>');
						$("#username").focus();
					//$('#res1').attr('innerHTML','<font color=red>请输入密码</font>');
		   			//$("#pwd").focus();
				}else{
					
					$("#form2").submit();
				}
			}
		
		});
	}
		</script>
	</head>
	
	<body>
		<div class="login_top"></div>
		<div class="login_center">
			<form action="loginAction" method="post" name="login" id="form2">
				<center>
					<div class="login_name">
						<input type="text" name="username" id="username" size="17.5"
							style="height: 25px; font-size: 18px; color: buttonshadow; background: transparent; border: 0;" />
						<div class="error" id="res"></div>
					</div>
					<div class="login_password">
						<input type="password" name="pwd" id="pwd" size="17.5"
							style="height: 25px; font-size: 18px; color: buttonshadow; background: transparent; border: 0;" />
						<div class="error" id="res1"></div>
					</div>
					<div class="login_sub">
						<input type="image" name="submin" src="images/login_05.png" onclick="test(); return false;"/>
					</div>
					<div class="login_reset">
						<input type="image" name="reset" src="images/login_04.png" onclick="reset(); return false;"/>
					</div>
					<div class="login_fux">
						<input type="checkbox" value="记住密码" />
						&nbsp;记住密码?
					</div>
				</center>
			</form>
		</div>
		<div class="login_footer">
			<center>
				Greentruss Singapore Pte Ltd.&nbsp;&nbsp; All Rights Reserved
			</center>
		</div>
	</body>
</html>
